<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <SONIA ZRIBI>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <SONIA ZRIBI>
 */
class Application_Model_ConfigStat extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdconfigStat;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_NomRapport;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_PlanRapport;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_CritereGroupement;



    /**
     * Dependent relation fk_config_colonne_stat_config_stat1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_ConfigColonneStat
     */
    protected $_ConfigColonneStat;

    /**
     * Dependent relation fk_rapport_config_stat1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Rapport
     */
    protected $_Rapport;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idconfig_stat'=>'IdconfigStat',
            'nom_rapport'=>'NomRapport',
            'plan_rapport'=>'PlanRapport',
            'critere_groupement'=>'CritereGroupement',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
            'FkConfigColonneStatConfigStat1' => array(
                    'property' => 'ConfigColonneStat',
                    'table_name' => 'ConfigColonneStat',
                ),
            'FkRapportConfigStat1' => array(
                    'property' => 'Rapport',
                    'table_name' => 'Rapport',
                ),
        ));
    }

    /**
     * Sets column idconfig_stat
     *
     * @param int $data
     * @return Application_Model_ConfigStat
     */
    public function setIdconfigStat($data)
    {
        $this->_IdconfigStat = $data;
        return $this;
    }

    /**
     * Gets column idconfig_stat
     *
     * @return int
     */
    public function getIdconfigStat()
    {
        return $this->_IdconfigStat;
    }

    /**
     * Sets column nom_rapport
     *
     * @param string $data
     * @return Application_Model_ConfigStat
     */
    public function setNomRapport($data)
    {
        $this->_NomRapport = $data;
        return $this;
    }

    /**
     * Gets column nom_rapport
     *
     * @return string
     */
    public function getNomRapport()
    {
        return $this->_NomRapport;
    }

    /**
     * Sets column plan_rapport
     *
     * @param string $data
     * @return Application_Model_ConfigStat
     */
    public function setPlanRapport($data)
    {
        $this->_PlanRapport = $data;
        return $this;
    }

    /**
     * Gets column plan_rapport
     *
     * @return string
     */
    public function getPlanRapport()
    {
        return $this->_PlanRapport;
    }

    /**
     * Sets column critere_groupement
     *
     * @param string $data
     * @return Application_Model_ConfigStat
     */
    public function setCritereGroupement($data)
    {
        $this->_CritereGroupement = $data;
        return $this;
    }

    /**
     * Gets column critere_groupement
     *
     * @return string
     */
    public function getCritereGroupement()
    {
        return $this->_CritereGroupement;
    }

    /**
     * Sets dependent relations fk_config_colonne_stat_config_stat1
     *
     * @param array $data An array of Application_Model_ConfigColonneStat
     * @return Application_Model_ConfigStat
     */
    public function setConfigColonneStat(array $data)
    {
        $this->_ConfigColonneStat = array();

        foreach ($data as $object) {
            $this->addConfigColonneStat($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_config_colonne_stat_config_stat1
     *
     * @param Application_Model_ConfigColonneStat $data
     * @return Application_Model_ConfigStat
     */
    public function addConfigColonneStat(Application_Model_ConfigColonneStat $data)
    {
        $this->_ConfigColonneStat[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_config_colonne_stat_config_stat1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_ConfigColonneStat
     */
    public function getConfigColonneStat($load = true)
    {
        if ($this->_ConfigColonneStat === null && $load) {
            $this->getMapper()->loadRelated('FkConfigColonneStatConfigStat1', $this);
        }

        return $this->_ConfigColonneStat;
    }

    /**
     * Sets dependent relations fk_rapport_config_stat1
     *
     * @param array $data An array of Application_Model_Rapport
     * @return Application_Model_ConfigStat
     */
    public function setRapport(array $data)
    {
        $this->_Rapport = array();

        foreach ($data as $object) {
            $this->addRapport($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_rapport_config_stat1
     *
     * @param Application_Model_Rapport $data
     * @return Application_Model_ConfigStat
     */
    public function addRapport(Application_Model_Rapport $data)
    {
        $this->_Rapport[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_rapport_config_stat1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Rapport
     */
    public function getRapport($load = true)
    {
        if ($this->_Rapport === null && $load) {
            $this->getMapper()->loadRelated('FkRapportConfigStat1', $this);
        }

        return $this->_Rapport;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_ConfigStat
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_ConfigStat());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_ConfigStat::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdconfigStat() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idconfig_stat = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdconfigStat()));
    }
}
